﻿package mortal.game.scene3D.layer3D
{
    import flash.utils.*;
    import frEngine.pools.*;
    import mortal.game.scene3D.map3D.*;

    public class MapPiece3DDictionary extends Object
    {
        private var _map:Dictionary;

        public function MapPiece3DDictionary()
        {
            this._map = new Dictionary(true);
            return;
        }// end function

        public function get map() : Dictionary
        {
            return this._map;
        }// end function

        public function addPiece(param1:int, param2:int, param3:int, param4:MapBitmap3D, param5:String) : void
        {
            this._map[param1 * 1000000 + param2 * 1000 + param3 + param5] = param4;
            return;
        }// end function

        public function getPieceBitmap(param1:int, param2:int, param3:int, param4:String) : MapBitmap3D
        {
            return this._map[param1 * 1000000 + param2 * 1000 + param3 + param4];
        }// end function

        public function removePiece(param1:int, param2:int, param3:int, param4:String, param5:Boolean = false) : void
        {
            var _loc_6:* = this.getPieceBitmap(param1, param2, param3, param4);
            if (_loc_6 && param5)
            {
                _loc_6.dispose();
                delete this._map[param1 * 1000000 + param2 * 1000 + param3 + param4];
            }
            return;
        }// end function

        public function removeAll() : void
        {
            var _loc_1:MapBitmap3D = null;
            var _loc_2:String = null;
            for (_loc_2 in this._map)
            {
                
                _loc_1 = this._map[_loc_2] as MapBitmap3D;
                _loc_1.dispose();
                this._map[_loc_2] = null;
            }
            this._map = new Dictionary();
            return;
        }// end function

        public function getMapBitmap() : MapBitmap3D
        {
            return FrObjectPool.getObject(MapBitmap3D, this);
        }// end function

        public function hasBitmap(param1:int, param2:int, param3:int, param4:String) : Boolean
        {
            return this._map[param1 * 1000000 + param2 * 1000 + param3 + param4] != null;
        }// end function

        public function getMapPieceNum() : int
        {
            var _loc_1:int = 0;
            var _loc_2:Object = null;
            for each (_loc_2 in this._map)
            {
                
                _loc_1++;
            }
            return _loc_1;
        }// end function

        public function clearMap() : void
        {
            var _loc_1:MapBitmap3D = null;
            for each (_loc_1 in this._map)
            {
                
                _loc_1.dispose();
            }
            this._map = new Dictionary(true);
            return;
        }// end function

        public function disposeBitmap() : void
        {
            var _loc_1:MapBitmap3D = null;
            var _loc_2:* = undefined;
            for (_loc_2 in this._map)
            {
                
                _loc_1 = this._map[_loc_2] as MapBitmap3D;
                if (_loc_1.canDispose)
                {
                    _loc_1.dispose();
                    delete this._map[_loc_2];
                }
            }
            return;
        }// end function

    }
}
